package com.guice.web.guice_webapp_example.servlet;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.guice.web.guice_webapp_example.service.IndexService;

import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Singleton
public class IndexServlet extends HttpServlet {

    @Inject
    IndexService indexService;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getOutputStream().print(indexService.say("index page"));
    }
}
